import { RouteRecordRaw } from 'vue-router'
// import home from './modules/home'

const Layout = () => import('@/layout/index.vue')

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/dashboard',
    component: Layout,
    name: 'dashboard',
    meta: {
      title: 'dashboard',
    },
    children: [
      {
        path: '/dashboard',
        name: 'dashboard',
        component: () => import('@/views/dashboard/index.vue'),
        meta: {
          title: '首页',
          affix: true,
        },
      },
    ],
  },
  {
    path: '/login',
    name: 'Login',
    meta: {
      title: '登录',
      hidden: true,
    },
    component: () => import('@/views/login/index.vue'),
  },
  // ...home,
  {
    path: '/error',
    name: 'Error',
    component: Layout,
    redirect: '/error/403',
    children: [
      {
        path: '403',
        name: 'Error403',
        component: () => import('@/views/error/403.vue'),
        meta: {
          title: '403',
          icon: 'error-warning-line',
        },
      },
      {
        path: '404',
        name: 'Error404',
        component: () => import('@/views/error/404.vue'),
        meta: {
          title: '404',
          icon: 'error-warning-line',
        },
      },
    ],
  },
  {
    path: '/:catchAll(.*)',
    component: Layout,
    meta: {
      icon: 'PieChartOutlined',
      title: '错误页',
      hidden: true,
    },
    children: [
      {
        path: '',
        redirect: '/error/404',
      },
    ],
  },
]

export default routes
